package com.imut.oa.common;

public class ResultUtils {
    /**
     * 成功
     * @param
     * @return
     * @param <T>
     */
    public static <T> BaseResponse<T> success(){
        return new BaseResponse<>(0,null,"ok","成功");
    }
    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse<>(0,data,"ok","成功");
    }
    public static <T> BaseResponse<T> success(T data,String description){
        return new BaseResponse<>(0,data,"ok",description);
    }
    public static BaseResponse error(ErrorCode errorCode){
        return new BaseResponse(errorCode);
    }

    public static BaseResponse error(int code, String message, String description) {
        return new BaseResponse(code,null,message,description);
    }

    public static BaseResponse error(ErrorCode errorCode, String message) {
        return new BaseResponse(errorCode.getCode(),message);
    }
}
